/**
 * Copyright 2021 xpstem.com
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.xpstem.lelink.device;

import com.xpstem.lelink.EventBus;
import com.xpstem.lelink.enums.InputPort;

import java.util.HashMap;
import java.util.Map;

/**
 * EV3 gyro sensor
 *
 * @author billy zhang
 */
public class EV3GyroSensor extends EV3Sensor {

    /**
     * TYPE
     */
    public static final short TYPE = 32;
    /**
     * MODE
     */
    public static final short MODE_ANGLE = 0;
    public static final short MODE_RATE = 1;
    public static final short MODE_FAST = 2;
    public static final short MODE_RATE_ANGLE = 3;
    public static final short MODE_CALIBRATION = 4;

    private static Map<Short, String> modeMap;
    static {
        modeMap = new HashMap<>();
        modeMap.put(MODE_ANGLE, "Angle");
        modeMap.put(MODE_RATE, "Rate");
        modeMap.put(MODE_FAST, "Fast");
        modeMap.put(MODE_RATE_ANGLE, "Angle");
        modeMap.put(MODE_CALIBRATION, "Calibration");
    }

    public EV3GyroSensor(EventBus eventBus, InputPort portNo, short mode) {
        super(eventBus, portNo, "Gyro Sensor", TYPE, mode);
    }

    @Override
    public Map<Short, String> getModeMap() {
        return modeMap;
    }
}
